home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 February / CMCD0205.ISO / Software / Freeware / Programare / bluej / bluejsetup-203.exe / {app} / lib / spanish / templates / newclass / appletj.tmpl < prev    next >
Text File  |  2004-12-19  |  4KB  |  129 lines

  1. $PKGLINE
  2. import java.awt.*;
  3. import javax.swing.*;
  4.  
  5. /**
  6.  * Class $CLASSNAME - write a description of the class here
  7.  * 
  8.  * @author (your name)
  9.  * @version (version number)
  10.  */
  11. public class $CLASSNAME extends JApplet
  12. {
  13.     // instance variables - replace the example below with your own
  14.     private int x;
  15.  
  16.      /**
  17.      * Called by the browser or applet viewer to inform this JApplet that it
  18.      * has been loaded into the system. It is always called before the first 
  19.      * time that the start method is called.
  20.      */
  21.     public void init()
  22.     {
  23.         // this is a workaround for a security conflict with current browsers
  24.         // including Netscape & Internet Explorer which do not allow access to 
  25.         // AWT system event queues which JApplets do on startup to check access. 
  26.         JRootPane rootPane = this.getRootPane();    
  27.         rootPane.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
  28.     
  29.         // provide any initialisation necessary for your JApplet
  30.  
  31.     }
  32.  
  33.     /**
  34.      * Called by the browser or applet viewer to inform this JApplet that it 
  35.      * should start its execution. It is called after the init method and 
  36.      * each time the JApplet is revisited in a Web page. 
  37.      */
  38.     public void start()
  39.     {
  40.         // provide any code requred to run each time 
  41.         // web page is visited
  42.  
  43.     }
  44.  
  45.     /** 
  46.      * Called by the browser or applet viewer to inform this JApplet that
  47.      * it should stop its execution. It is called when the Web page that
  48.      * contains this JApplet has been replaced by another page, and also
  49.      * just before the JApplet is to be destroyed. 
  50.      */
  51.     public void stop()
  52.     {
  53.         // provide any code that needs to be run when page
  54.         // is replaced by another page or before JApplet is destroyed 
  55.     
  56.     }
  57.  
  58.     /**
  59.      * Called by the browser or applet viewer to inform this JApplet that it
  60.      * is being reclaimed and that it should destroy any resources that it
  61.      * has allocated. The stop method will always be called before destroy. 
  62.      */
  63.     public void destroy()
  64.     {
  65.         // provide code to be run when JApplet is about to be destroyed.
  66.     
  67.     }
  68.  
  69.  
  70.     /**
  71.      * Returns information about this applet. 
  72.      * An applet should override this method to return a String containing 
  73.      * information about the author, version, and copyright of the JApplet.
  74.      *
  75.      * @return a String representation of information about this JApplet
  76.      */
  77.     public String getAppletInfo()
  78.     {
  79.         // provide information about the applet
  80.         return "Title:   \nAuthor:   \nA simple applet example description. ";
  81.     }
  82.  
  83.  
  84.     /**
  85.      * Returns parameter information about this JApplet. 
  86.      * Returns information about the parameters than are understood by this JApplet.
  87.      * An applet should override this method to return an array of Strings 
  88.      * describing these parameters. 
  89.      * Each element of the array should be a set of three Strings containing 
  90.      * the name, the type, and a description.
  91.      *
  92.      * @return a String[] representation of parameter information about this JApplet
  93.      */
  94.     public String[][] getParameterInfo()
  95.     {
  96.         // provide parameter information about the applet
  97.         String paramInfo[][] = {
  98.                  {"firstParameter",    "1-10",    "description of first parameter"},
  99.                  {"status", "boolean", "description of second parameter"},
  100.                  {"images",   "url",     "description of third parameter"}
  101.         };
  102.         return paramInfo;
  103.     }
  104.  
  105.     /**
  106.      * Paint method for applet.
  107.      * 
  108.      * @param  g   the Graphics object for this applet
  109.      */
  110.     public void paint(Graphics g)
  111.     {
  112.         // simple text displayed on applet
  113.         g.drawString("Sample JApplet", 20, 20);
  114.     }
  115.  
  116.  
  117.     /**
  118.      * An example of a method - replace this comment with your own
  119.      *     
  120.      * @param  y   a sample parameter for a method
  121.      * @return     the sum of x and y 
  122.      */
  123.     public int sampleMethod(int y)
  124.     {
  125.         // put your code here
  126.         return x + y;
  127.     }
  128. }
  129.